//
//  recordView.m
//  DoorBell
//
//  Created by eques on 2024/2/23.
//  Copyright © 2024 eques. All rights reserved.
//

#import "CatRecordView.h"

@interface CatRecordView()

@end

@implementation CatRecordView

- (instancetype)init
{
    if(self = [super init]){
        
    }
    return self;
}



- (UIButton*)recordButton
{
    if (!_recordButton) {
        _recordButton = [[UIButton alloc] init];
        [self addSubview:_recordButton];
        [_recordButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.mas_equalTo(120);
            make.centerY.equalTo(self.mas_centerY);
            make.height.mas_equalTo(50);
            make.centerX.equalTo(self.mas_centerX);
        }];
        [_recordButton addTarget:self action:@selector(clickUpdateBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    }
     return _recordButton;
}

#pragma  mark 点击录制
- (void)clickUpdateBtnClick:(UIButton *)sender{
    if (self.recordBlock){
        self.recordBlock();
    }
}


- (UIButton*)stopButton
{
    if (!_stopButton) {
         _stopButton = [[UIButton alloc] init];
        [self addSubview:_stopButton];
        [_stopButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.mas_equalTo(36);
            make.centerY.equalTo(self.mas_centerY);
            make.height.mas_equalTo(36);
            make.right.equalTo(self.recordButton.mas_left).offset(-35);
        }];
        [_stopButton addTarget:self action:@selector(stopBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    }
     return _stopButton;
}
#pragma  mark 点击关闭
- (void)stopBtnClick:(UIButton *)sender{
    if (self.stopBlock){
        self.stopBlock();
    }
}


- (UIButton*)postButton
{
    if (!_postButton) {
         _postButton = [[UIButton alloc] init];
        [self addSubview:_postButton];
        [_postButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.mas_equalTo(36);
            make.centerY.equalTo(self.mas_centerY);
            make.height.mas_equalTo(36);
            make.left.equalTo(self.recordButton.mas_right).offset(35);
        }];
        [_postButton addTarget:self action:@selector(postBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    }
     return _postButton;
}
#pragma  mark 点击关闭
- (void)postBtnClick:(UIButton *)sender{
    if (self.postBlock){
        self.postBlock();
    }
}

- (UILabel*)deslabel
{
    if (!_deslabel) {
         _deslabel = [[UILabel alloc]init];
         [self addSubview:_deslabel];
          _deslabel.textColor = [HexChangeRGB colorWithHexString:@"#666666"];
          _deslabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:14.0];
          _deslabel.numberOfLines = 0;
         [_deslabel sizeToFit];
         [_deslabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.recordButton.mas_bottom).offset(10);
            make.centerX.equalTo(self.mas_centerX);
         }];
    }
       
    return _deslabel;
}


- (UILabel*)timelabel
{
    if (!_timelabel) {
          _timelabel = [[UILabel alloc]init];
         [self addSubview:_timelabel];
          _timelabel.textColor = [HexChangeRGB colorWithHexString:@"#666666"];
          _timelabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:20.0];
          _timelabel.numberOfLines = 0;
         [_timelabel sizeToFit];
         [_timelabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(self.recordButton.mas_top).offset(-20);
            make.centerX.equalTo(self.mas_centerX);
         }];
    }
       
    return _timelabel;
}


@end
